package com.test.common.concurrency;
//实现多线程 runnable

//线程的run和start的区别 https://blog.csdn.net/weixin_47872288/article/details/121251371
public class MyRunnable implements Runnable {
	@Override
	public void run() {
		for (int i = 0; i < 20; i++) {
			System.out.println(Thread.currentThread().getName() + " 分支线程" + i);
		}
	}

	public static void main(String[] args) {
		// 创建自定义类对象 线程任务对象
		MyRunnable mr = new MyRunnable();
		// 创建线程对象
		Thread t = new Thread(mr, "线程名");
		t.start();
		for (int i = 0; i < 20; i++) {
			System.out.println("主线程 " + i);
		}

	}
}